package com.viroyal.monitorlib.entity;

import com.google.gson.Gson;
import com.google.gson.annotations.SerializedName;

/**
 * Created by zy on 2017/11/17.
 */
public class UpdateS {
    public String action;
    public long id;
    public int uninstall;
    public String url;
    @SerializedName("version_code")
    public int version_code;
    @SerializedName("pkg_name")
    public String pkg_name;
    //用以保存rrpc的messageId;
    public long mrrpcId = 0;

    @SerializedName("data")
    public String data;
    @SerializedName("is_force_upgrade")
    public int is_force_upgrade;

    public UpdateS simlulate() {
        action = "pkg_info";
        id = 12345;
        uninstall = 0;
        url = "";
        version_code = 1;
        pkg_name = "com.viroyal.monitor";
        return this;
    }

    public UpdateS upLoadApp(String action,long id,int uninstall,String url,int version_code,String pkg_name,int is_force_upgrade) {
        this.action = action;
        this.id = id;
        this.uninstall = uninstall;
        this.url = url;
        this.version_code = version_code;
        this.pkg_name = pkg_name;
        this.is_force_upgrade = is_force_upgrade;
        return this;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }
}
